public virtual with sharing class ProtectedExample {
   
     protected integer retInt(){
        
        return 6;
        
     }
    public class test1{
        integer intIst ;
       public test1(){
            ProtectedExample protectedIst = new ProtectedExample();
            intIst = protectedIst.retInt();
            System.debug('@@@@@@@@@@retInt'+intIst);
        }
    }
 
}